<?php
/**
 * BUDDYPRESS TEST PANEL - WP 3.4.1 | SINGLE SITE MODE
 *
 * @version 1.6.1
 * @since 1.6.1
 * @package Unit Test
 * @subpackage Panel
 * @license GPL v2.0
 *
 * ========================================================================================================
 */


class panel_BP_wp341_singleSite extends RAZ_testPanel_base {

    	
    public function __construct() {

	    $this->slug = "panel_BP_wp341_singleSite";
	    $this->name = "WP 3.4.1 | SINGLE SITE MODE";   		
    }	


    /**
     * This method is used to add globals and defines that would normally be set in 'wp-config.php'
     *
     * @version 1.6.1
     * @since 1.6.1
     * @return bool | Exception on failure. True on success.      
     */
    public function setupGlobals() {

	    define('DB_CHARSET', 'utf8');
	    define('DB_COLLATE', '');

	    // The keys and salts defined below have to be the ones that were set in 'wp-config.php' on 
	    // the WP installation used to create the database image file loaded by setupDB()

	    define('AUTH_KEY',         '*Pj&3<:@a1/i*7R.}y*;_W5zV,em-R@`QL,Cj`B}qF#LU}8`|^/;S=MD%qMaS8Xx');
	    define('SECURE_AUTH_KEY',  'yCZ2Zi7T.:5~]EYlLDaM/#,X.+6  !iCc{(!.TnsvE~M{ 7MyFZa&]_IYi5Obn],');
	    define('LOGGED_IN_KEY',    '#[x3Q7/2 )o){UBAuS}PLe%FL3E3cn&AI4LLp@}yc)qteygyZac/n<7P;]k7HW~k');
	    define('NONCE_KEY',        '% St6NIpC[]bDxlZ*r%X=5_C9&M0 Fm:{hO8~eNE,IdGnqh?N9 pQ#f9YwX}lGhL');
	    define('AUTH_SALT',        'd]^L5BWX?,.k{rYO0}joG!}<8D#v,TWo}yk3.NVK(Vk*bx{E!JyvbugvbqFCb>n%');
	    define('SECURE_AUTH_SALT', 'D%JFMkYA|=PCY $gHSrgmlWNPIt@JC$g*@Z,VX;OsG-,Lt^6+&ta@>2+~hcS/3)S');
	    define('LOGGED_IN_SALT',   'g$x}a;}duCo Ir[yqi/7.tNoMxYUPg]OGudK[!rWiwv#b*khb%j,?=(Ts>&D+h?-');
	    define('NONCE_SALT',       'Aaxb#P1wW?0}zwbgmMlP.*Tu*)_!Vb5B=xCf_V0o.^E$Z:<:b-`5Rv8X[>V(w;.c');

	    define('WPLANG', '');
	    define('WP_DEBUG', false);
	    
	    //$_SERVER['REQUEST_URI'] = "/members/admin/foo/bar/baz";

	    return true;
    }

    
    /**
     * Move assets (such as plugin files) into place before the test runner spins-up
     * the WordPress installation
     *
     * @version 1.6.1
     * @since 1.6.1
     * @return bool | Exception on failure. True on success.        
     */
    public function setupAssets() {

	    return true;
    }


    /**
     * Set up db image and remapping options
     *
     * @version 1.6.1
     * @since 1.6.1
     * @return bool | Exception on failure. True on success.        
     */
    public function setupDB() {

	    global $razor;

	    // Enable SQL image load and set path
	    $razor->load_db_image = true;
	    $razor->db_image_file = $razor->path_testplan . '/db_images/wp-3.4.1-single.sql';

	    return true;		
    }


    /**
     * Perform any setup tasks that have to be completed after the DB image has been loaded
     * but before the test groups are run
     *
     * @version 1.6.1
     * @since 1.6.1
     * @return bool | Exception on failure. True on success.        
     */	
    public function setupState() {

	    $cls = new RAZ_pluginManager();	
	    
	    try {
		    $cls->activatePlugin($folder='buddypress', $loader='bp-loader.php', $blog_id=null);
	    }
	    catch (RAZ_exception $child){

		    $error = array(
			    'numeric'=>1,
			    'text'=>"Error activating plugin",
			    'data'=>array('folder'=>$folder, 'loader'=>$loader),
			    'file'=>__FILE__, 'line'=>__LINE__, 'method'=>__METHOD__,
			    'child'=>$child
		    );
		    
		    throw new RAZ_exception($error);				
	    }

	    return true;

    }


    /**
     * Cleanup assets after completion of the test panel
     *
     * @version 1.6.1
     * @since 1.6.1
     * @return bool | Exception on failure. True on success.        
     */
    public function tearDownAssets() {

	    return true;
    }			
	
    
}

$cls = new panel_BP_wp341_singleSite();

global $razor;
$razor->registerTestPanel($cls);

?>